const mongoose = require('mongoose');

mongoose.connect('mongodb://127.0.0.1:27017/data');

mongoose.connection.on('open', ()=>{
    var songSchema = new mongoose.Schema({
        title:String,
        author:String
    })
    let songModel = mongoose.model('song',songSchema,'song');

    songModel.create({title:'野狼disco',author:'老舅'},(err,data)=>{
        if(err) throw err;
        console.log(data);

        mongoose.connection.close();
    })
})